package br.poli.ecomp.tcc.stimultimidia.control.command
{
	import br.poli.ecomp.tcc.stimultimidia.business.ConexResponder;
	import br.poli.ecomp.tcc.stimultimidia.business.FachadaDelegate;
	import br.poli.ecomp.tcc.stimultimidia.model.FachadaRemoteProxy;
	import br.poli.ecomp.tcc.stimultimidia.model.vo.UsuarioVO;
	import br.poli.ecomp.tcc.stimultimidia.notification.TelaNotification;
	
	import org.puremvc.as3.interfaces.ICommand;
	import org.puremvc.as3.interfaces.INotification;
	import org.puremvc.as3.patterns.command.SimpleCommand;
	
	public class LoginCommand extends SimpleCommand implements ICommand
	{

		override public function execute(notification:INotification):void
		{
			var user:UsuarioVO = notification.getBody() as UsuarioVO;
			
			trace( user.login ,user.senha );
			
			
			var responder:ConexResponder = new ConexResponder( onResult , onFault );	
			var fachada:FachadaDelegate = new FachadaDelegate( responder );
			
			//fachada.logarUsuario( user );
			onResult(null);
			
		}
		public function onResult(obj:Object):void{
			sendNotification( TelaNotification.ABRIR_TELA_MAIN );
		}
		
		public function onFault(obj:Object):void{
			
		}
		
		
	}
}